package com.GLM.Viewer.MyNews;

import java.util.List;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

public class ViewPagerAdapter extends PagerAdapter {

	private List<View> listViews;

	public ViewPagerAdapter(List<View> views) {
		listViews = views;
	}

	@Override
	public Object instantiateItem(ViewGroup container, int position) {
		container.addView(listViews.get(position), 0);
		return listViews.get(position);
	}

	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		container.removeView(listViews.get(position));
	}

	@Override
	public int getCount() {
		if (listViews != null) {
			return listViews.size();
		}
		return 0;
	}

	@Override
	public boolean isViewFromObject(View arg0, Object arg1) {
		return (arg0 == arg1);
	}

}
